Sets or clears the read-only attribute on a file. Use to allow or prevent scripts from modifying a file.
Syntax
SetFileReadOnly("FilePath", True/False)
Arguments
| Argument | Description |
|---|---|
| FilePath | Full path to the file. See Identifying files and directories in statements for information about configuring full paths relative to the workspace or script directory. |
| True/False | True sets the read-only attribute on the file. False clears the read-only attribute to make the file writable. |
Example
'User-defined subroutine that deletes files
Sub SafeDelete(filePath)
SetFileReadOnly(filePath, False) 'Makes read-only files writable
DeleteFile(filePath)
End Sub
SafeDelete("C:\\Testing\\TestResults.txt")
SafeDelete("C:\\Testing\\TestScreenshot.png")